package com.zua.service.impl;
import com.zua.entity.User;
import com.zua.mapper.UserMapper;
import com.zua.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional(readOnly = false,timeout = 5,propagation = Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED)
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }
    @Override
    public void insertUser(User user) {
        userMapper.insertUser(user);
    }
    @Override
    public void deleteById(int id) {
        userMapper.deleteById(id);
    }
    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }
    @Override
    public User selectById(int id) {
        return userMapper.selectById(id);
    }
    @Override
    public User selectByName(String name) {
        return userMapper.selectByName(name);
    }
    @Override
    public List<User> showAll(int pageNum, int pageSize) {
        return userMapper.showAll(pageNum, pageSize);
    }
}
